import Vue from 'vue'

import ViewUI from 'view-design'
import 'view-design/dist/styles/iview.css'
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)
import eniview from 'view-design/dist/locale/en-US'
import zhiview from 'view-design/dist/locale/zh-CN'
import TWiview from 'view-design/dist/locale/zh-TW'
import jaiview from 'view-design/dist/locale/ja-JP'
import koiview from 'view-design/dist/locale/ko-KR'

import en from './i18n/en.json'
import zh from './i18n/zh.json'
import zf from './i18n/zf.json'
import ja from './i18n/ja.json'
import ko from './i18n/ko.json'

import App from './App.vue'
import router from './router'
import store from './store'
import './styles/global.less'
import VueI18n from 'vue-i18n'
import $ from 'jquery'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
import { isAuth } from "./utils/auth.js"

import global from './components/loading/global'

Vue.use(Viewer)
Viewer.setDefaults({
  Options: {
    inline: true,
    button: true,
    navbar: false,
    title: true,
    toolbar: false,
    tooltip: true,
    movable: true,
    zoomable: true,
    rotatable: true,
    scalable: true,
    transition: true,
    fullscreen: true,
    keyboard: true,
    url: 'data-source',
  },
})

Vue.use(VueI18n)
Vue.prototype.$ = $

Vue.prototype.isAuth = isAuth

Vue.locale = () => {}

const i18n = new VueI18n({
  locale: localStorage.getItem('language') || 'zh',
  messages: {
    'zh': Object.assign(zh, zhiview),
    'en': Object.assign(en, eniview),
    'zf': Object.assign(zf, TWiview),
    'ja': Object.assign(ja, jaiview),
    'ko': Object.assign(ko, koiview)
  },
})

Vue.config.productionTip = false
Vue.use(ViewUI, {
  i18n: (key, value) => i18n.t(key, value)
})


export default i18n

new Vue({
  router,
  store,
  i18n,
  render: (h) => h(App),
}).$mount('#app')
